package com.tyk.bookstore.front.logistics.controller;


import com.tyk.bookstore.front.common.core.model.result.R;
import com.tyk.bookstore.front.logistics.model.vo.WaybillVo;
import com.tyk.bookstore.front.logistics.service.WaybillService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tyk
 * @description 运单管理
 */
@Tag(name = "物流管理/运单管理", description = "运单管理")
@RequestMapping({"api/logistics/waybill"})
@RestController
@Validated
@RequiredArgsConstructor
public class WaybillController {

    private final WaybillService waybillService;


    @GetMapping({"{id}"})
    @Operation(summary = "获取运单详情", description = "获取运单详情")
    public R<WaybillVo> getById(
            @Schema(description = "运单ID") @NotNull @Min(1)
            @PathVariable Long id
    ) {
        return R.ok(waybillService.getById(id));
    }

}
